var express = require('express')
var router = express.Router()
const categoryCtrl = require('../controller/category')
const categoryValidator = require('../validator/category')
const isAdminCheck = require('../middleware/isAdminCheck')
// 添加分类（管理员权限）
router.post('/category', isAdminCheck, categoryValidator.addCategory, categoryCtrl.addCategory)
//删除分类（管理员权限）
router.delete('/category/:id', isAdminCheck, categoryValidator.delCategory, categoryCtrl.delCategory)
// 修改分类（管理员权限）
router.put('/category/:id', isAdminCheck, categoryValidator.updateCategory, categoryCtrl.updateCategory)
// 获取分类列表
router.get('/categories', categoryCtrl.getCategoryList)

module.exports = router
